package com.scalar.chiptrack.operations.inventoryps.actions;

import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.scalar.chiptrack.ChipTrackAction;
import com.scalar.chiptrack.actioncommands.ActionCommand;
import com.scalar.chiptrack.commons.SessionKeys;
import com.scalar.chiptrack.operations.inventoryps.actioncommands.InventoryPackingSlipActionCommandFactory;

public class InventoryPackingSlipAction  extends ChipTrackAction implements SessionKeys
{
	public ActionForward execute (ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
        HashMap<String, String> errors = new HashMap<String, String>();
        request.setAttribute( ERROR_MESSAGES, errors );
        ActionForward actionForward;
        String action = request.getParameter( "action" );
        //actionForward = mapping.findForward("showLots");
        
        try
        {
            ActionCommand inventoryPackingSlipCmd;
            inventoryPackingSlipCmd = InventoryPackingSlipActionCommandFactory.getActionCommand( action );
            actionForward   = inventoryPackingSlipCmd.execute( mapping, form, request, response );
        }
        catch (Exception e)
        {
            errors.put("Unable to load the Proecss Type in Inventory Packing Slip Screen", null);
            actionForward = mapping.findForward( "inventoryPS" );
        }
        return actionForward;
	}
}
